﻿@model KL.Store.Web.Models.ProductsModel
@using KL.Store.Core
@{
    Layout = null;
    var cssColumnClass = "";
    var columnCount = 4;
    var rowCount = 1;
    var mobileDouble = true;
    var showNamesBottom = false;
    var addToCartButtonStyle = 1;
    var showMultiImages = false;
    var sliderForProducts = false;
    if (Model.ColumnCount == 1)
    {
        cssColumnClass = "col-xs-12 col-sm-12 col-md-12 col-lg-12";
        if (mobileDouble)
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-12 col-lg-12";
        }
        columnCount = 1;
    }
    else if (Model.ColumnCount == 2)
    {
        cssColumnClass = "col-xs-12 col-sm-12 col-md-6 col-lg-6";
        if (mobileDouble)
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-6 col-lg-6";
        }
        columnCount = 2;
    }
    else if (Model.ColumnCount == 3)
    {
        cssColumnClass = "col-xs-12 col-sm-12 col-md-4 col-lg-4";
        if (mobileDouble)
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-4";
        }
        columnCount = 3;
    }
    else if (Model.ColumnCount == 4)
    {
        cssColumnClass = "col-xs-12 col-sm-12 col-md-4 col-lg-3";
        if (mobileDouble)
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        }
        columnCount = 4;
    }
    else if (Model.ColumnCount == 6)
    {
        cssColumnClass = "col-xs-12 col-sm-12 col-md-4 col-lg-2";
        if (mobileDouble)
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-2";
        }
        columnCount = 6;
    }
    else
    {
        cssColumnClass = "col-xs-12 col-sm-12 col-md-4 col-lg-3";
        if (mobileDouble)
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        }
        columnCount = 4;
    }
    var listImageType = "";
    if (Model.ListImageType == "w")
    {
        listImageType = "_w";
    }
    else if (Model.ListImageType == "t")
    {
        listImageType = "_t";
    }
    else if (Model.ListImageType == "s")
    {
        listImageType = "_s";
    }
    else
    {
        listImageType = "";
    }
    var mainWidth = "";
    if (Parameters.Theme == "HA" || Parameters.Theme == "JB")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-12 col-lg-12";
        if (Parameters.Theme == "JB")
        {
            mainWidth += " first last";
        }
    }
    else if (Parameters.Theme == "DK")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last right";
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-4";
        columnCount = 3;
        listImageType = "";
        showNamesBottom = true;
        addToCartButtonStyle = 2;
    }
    else if (Parameters.Theme == "EO")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last right productsMain";
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        columnCount = 4;
        listImageType = "";
        showNamesBottom = false;
        addToCartButtonStyle = 2;
        sliderForProducts = true;
        rowCount = 2;
    }
    else if (Parameters.Theme == "WU")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-9col-lg-9 first last right productsMain";
        cssColumnClass = "col-xs-6 col-sm-6 col-md-3 col-lg-3";
        columnCount = 4;
        listImageType = "";
        showNamesBottom = false;
        addToCartButtonStyle = 3;
        sliderForProducts = true;
        rowCount = 2;
    }
    else
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-9 col-lg-10 right";
    }
    var firstLast = "";
    if (Parameters.Theme == "HA" || Parameters.Theme == "JB")
    {
        firstLast = "first last";
    }
    if (Parameters.Theme == "HA")
    {
        showMultiImages = true;
        if (ViewBag.ShowCase)
        {
            showMultiImages = false;
        }
        if (Model.CategoryId == 11)
        {
            sliderForProducts = true;
        }
    }
    var kkMetin = "Kredi Kartı";
    var snMetin = "Senetli";
    if (columnCount > 4)
    {
        kkMetin = "K.Kartı";
        snMetin = "Senetli";
    }
}
<div class="@mainWidth @firstLast">
    @{if (Model.BannerActive)
      {
        <div class="hidden-xs hidden-sm col-md-12 col-lg-12 banner-alt @firstLast">
            <img src="@(Parameters.WebSiteImageUrl)/category-banner/@(Model.CategoryId).jpg" alt="@Model.CategoryName" />
        </div>
        <div class="col-xs-12 col-sm-12 hidden-md hidden-lg">
            <h3>@Model.CategoryName</h3>
        </div>
        <div class="clearfix"></div>
      }
      else if (ViewBag.ShowTextTitle)
      {
        <span class="categoryTitle">@Model.CategoryName</span>
      }
    }
    @if (Model.BreadCrumb == "")
    {
        <div class="breadcrumb">
            <div class="bcBorder"></div>
            <div class="bcLinks">
                @Html.Raw(Model.BreadCrumb)
            </div>
            <div class="bcBorder"></div>
        </div>
    }
    @if (Model.IsManager)
    {
        <a href="/Products/AddProductToCategory/@(Model.CategoryId)" class="urunEkle fancybox.iframe edit-genel">
            <i class="fa fa-link fa-2x"></i>
        </a>
    }
    @if (Model.RelatedProducts.Count >= 1)
    {
        var modeStr = "productsListHome";
        if (ViewBag.SmallMode)
        {
            modeStr = "productsListSmall";
        }
        <div class="products r@(rowCount) s@(columnCount)@(listImageType) @modeStr" id="products@(Model.CategoryId)">
            <ul class="productsList">
                @{ var itemCounter = 1; }
                @foreach (var item in Model.RelatedProducts)
                {
                    //if (Parameters.Theme == "HA")
                    //{
                    //    item.LinkUrl = "#";
                    //}
                    var inLastColumn = "";
                    if (columnCount != 0 && itemCounter % columnCount == 0)
                    {
                        inLastColumn = "inLastColumn";
                    }
                    else
                    {
                        inLastColumn = "";
                    }
                    <li class="productLi  product-block @cssColumnClass @inLastColumn s@(columnCount)@(listImageType) @if (!sliderForProducts)
                                                                                                                      { <text>notSlider</text> }">
                        <div class="product-outer">
                            <div class="product-inner">
                                <div class="product-image product-image-block">
                                    <a id="pr_@item.ProductId" class="prdLink" href="@item.LinkUrl" title="@(item.ProductName.Replace("\"", ""))">
                                        @if (item.ProductImageCount > 0)
                                        {
                                            if (Parameters.Theme == "JB" && ViewBag.LazyLoad)
                                            {
                                            <img id="ip_@item.ProductId" data-original="@(Parameters.WebSiteImageUrl)/product-medium/@(item.ProductId)_1@(listImageType).jpg" alt="@(item.ProductName.Replace("\"", ""))" />
                                            }
                                            else if (sliderForProducts || !showMultiImages)
                                            {
                                            <img id="ip_@item.ProductId" src="@(Parameters.WebSiteImageUrl)/product-medium/@(item.ProductId)_1@(listImageType).jpg" alt="@(item.ProductName.Replace("\"", ""))" />
                                            }
                                            else
                                            {
                                            <ul>
                                                @for (var pi = 1; pi <= item.ProductImageCount; pi++)
                                                {    
                                                    <li>
                                                        <img id="ip_@item.ProductId-@pi" src="@(Parameters.WebSiteImageUrl)/product-medium/@(item.ProductId)_@(pi + listImageType).jpg" alt="@(item.ProductName.Replace("\"", ""))" />
                                                    </li>
                                                }
                                            </ul>
                                            }
                                        }
                                        else
                                        {
                                            <img id="ip_@item.ProductId" src="/Images/@Parameters.Theme/product-image-not-found-200x.jpg" alt="@(item.ProductName.Replace("\"", ""))" />
                                        }
                                    </a>
                                    <a class="incele" href="@item.LinkUrl" title="@(item.ProductName.Replace("\"", ""))">İncele</a>
                                    @if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                    {
                                        <a href="@item.LinkUrl">
                                            @if (Parameters.Theme == "HA")
                                            {
                                                var bottomAbsolute = 10;
                                                if (!string.IsNullOrEmpty(item.SpecialText))
                                                {
                                                <div class="productprop prop_specialtext hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_text">
                                                            <span>@item.SpecialText</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                    bottomAbsolute += 31;
                                                }
                                                if (item.FastCargo)
                                                {
                                                    var fastStr = "Hızlı Kargo";
                                                    if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                    {
                                                        fastStr = "24 Saatte Kargo";
                                                    }
                                                <div class="productprop prop_24h hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_icon"></div>
                                                        <div class="prop_text">
                                                            <div class="prop_text_left"></div>
                                                            <span>@fastStr</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                    bottomAbsolute += 31;
                                                }
                                                else if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                {
                                                <div class="productprop prop_24h hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_icon"></div>
                                                        <div class="prop_text">
                                                            <div class="prop_text_left"></div>
                                                            <span>24 Saatte Kargo</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                    bottomAbsolute += 31;
                                                }
                                                else if (item.DeliveryPeriod == "Gün" && item.DeliveryTime <= Parameters.MinDeliveryTimeForFastCargo && item.DeliveryTime > 0)
                                                {
                                                <div class="productprop prop_24h hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_icon"></div>
                                                        <div class="prop_text">
                                                            <div class="prop_text_left"></div>
                                                            <span>Hızlı Kargo</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                    bottomAbsolute += 31;
                                                }

                                                if (item.FreeCargo)
                                                {
                                                <div class="productprop prop_free hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_icon"></div>
                                                        <div class="prop_text">
                                                            <div class="prop_text_left"></div>
                                                            <span>Ücretsiz Kargo</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                    bottomAbsolute += 31;
                                                }
                                                if (item.OpportunityProduct)
                                                {
                                                <div class="productprop prop_oppoturnity hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_icon"></div>
                                                        <div class="prop_text">
                                                            <div class="prop_text_left"></div>
                                                            <span>Fırsat Ürünü</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                    bottomAbsolute += 31;
                                                }
                                                if (!string.IsNullOrEmpty(item.GiftString))
                                                {
                                                <div class="productprop prop_gift hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                    <div class="prop_content">
                                                        <div class="prop_icon"></div>
                                                        <div class="prop_text">
                                                            <div class="prop_text_left"></div>
                                                            <span>@item.GiftString</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                }
                                                if (item.NewProduct)
                                                {
                                                <div class="prop_new hidden-xs hidden-sm"></div>
                                                }
                                                if (item.DiscountPercent > 0)
                                                {
                                                <div class="prop_discountPercent discountView2"><span>%</span>@Convert.ToInt32(item.DiscountPercent)<span class="dsccls">İNDİRİM</span></div>
                                                }
                                                else if (item.DiscountTotal > 0)
                                                {
                                                <div class="prop_discountPercent discountView2">@Convert.ToInt32(item.DiscountTotal)@Html.Raw(item.Currency == "TL" ? "<i class=\"fa fa-try\"></i>" : " " + item.Currency)<span class="dsccls">İNDİRİM</span></div>                                        
                                                }
                                                else if (item.DiscountDisplayTotal > 0)
                                                {
                                                <div class="prop_discountPercent discountView2"><span>%</span>@Convert.ToInt32(item.DiscountDisplayTotal)<span class="dsccls">İNDİRİM</span></div>                                    
                                                }
                                            }
                                            else
                                            {
                                                var leftAbsolute = 5;
                                                var bottomAbsolute = 1;
                                                //var topAbsolute = 190;
                                                //if (Parameters.Theme == "JB")
                                                //{
                                                //    topAbsolute = 262;
                                                //    if (ViewBag.SmallMode)
                                                //    {
                                                //        topAbsolute = 182;
                                                //    }

                                                //}
                                                //else if (Parameters.Theme == "EO")
                                                //{
                                                //    topAbsolute = 150;
                                                //}
                                                if (item.FastCargo)
                                                {
                                                    var fastImg = "Fast";
                                                    var fastStr = "1-3 Gün Kargo";
                                                    if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                    {
                                                        fastImg = "24h";
                                                        fastStr = "24 Saatte Kargo";
                                                    }
                                                <div class="label_fast prod_label" style="left:@(leftAbsolute)px;">
                                                    <img src="/Images/@(Parameters.Theme)/@{@fastImg}.png" alt="@fastStr" />
                                                </div>
                                                }
                                                else if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                {
                                                <div class="label_fast prod_label" style="left:@(leftAbsolute)px;">
                                                    <img src="/Images/@(Parameters.Theme)/24h.png" alt="24 Satte Kargo" />
                                                </div>
                                                }
                                                else if (item.DeliveryPeriod == "Gün" && item.DeliveryTime <= Parameters.MinDeliveryTimeForFastCargo && item.DeliveryTime > 0)
                                                {
                                                <div class="label_fast prod_label" style="left:@(leftAbsolute)px;">
                                                    <img src="/Images/@(Parameters.Theme)/Fast.png" alt="Hızlı Kargo" />
                                                </div>
                                                }
                                                if (item.FreeCargo)
                                                {
                                                <div class="label_free prod_label" style="bottom:@(bottomAbsolute)px;">
                                                    <img src="/Images/@(Parameters.Theme)/Free.png" />
                                                </div>
                                                    bottomAbsolute += 14;
                                                }
                                                if (item.OpportunityProduct)
                                                {
                                                <div class="label_opportunity prod_label" style="bottom:@(bottomAbsolute)px;">
                                                    <img src="/Images/@(Parameters.Theme)/Opportunity.png" />
                                                </div>
                                                    bottomAbsolute += 14;
                                                }
                                                if (item.NewProduct)
                                                {
                                                <div class="label_new prod_label" style="bottom:@(bottomAbsolute)px;">
                                                    <img src="/Images/@(Parameters.Theme)/New.png" />
                                                </div>
                                                    bottomAbsolute += 14;
                                                }
                                                if (item.DiscountPercent > 0)
                                                {
                                                <div class="prop_discountPercent"><span>%</span>@Convert.ToInt32(item.DiscountPercent)</div>
                                                }
                                                else if (item.DiscountDisplayTotal > 0)
                                                {
                                                <div class="prop_discountPercent"><span>%</span>@Convert.ToInt32(item.DiscountDisplayTotal)</div>                                        
                                                }
                                                if (!string.IsNullOrEmpty(item.GiftString))
                                                {
                                                <div class="prop_gift"><i class="glyphicon glyphicon-gift"></i>&nbsp;<span>@item.GiftString</span></div>
                                                }
                                            }

                                        </a>
                                    }
                                </div>
                                <a class="hizliBak" href="#quickViewContainer" title="@(item.ProductName.Replace("\"", ""))" data-id="@item.ProductId" data-name="@item.ProductName" data-prcode="@item.ProductCode" data-imgcount="@item.ProductImageCount"></a>
                                @if (!showNamesBottom)
                                {
                                    <div class="product-title">
                                        <a id="pl_@item.ProductId" class="prdLink" href="@item.LinkUrl">@(item.ProductName)</a>
                                    </div>
                                }
                                <div class="product-price">
                                    @{
                                var priceFilterStr = "###,###,##0.00";
                                if (Parameters.HideOddFromPrice)
                                {
                                    priceFilterStr = "###,###,##0";
                                }
                                var productOldPrice = item.OldPrice > 0 ? @item.OldPrice.ToString("###,###,##0") : "";
                                var productNewPrice = "";
                                var productExchangePrice = "";
                                decimal productNewPriceNumber = 0;
                                var productSecondPrice = "";
                                        
                                    }
                                    @if (Parameters.ShowExchangePricesWithoutTax && item.ExchangePrice > 0)
                                    {
                                        productExchangePrice = item.ExchangePrice.ToString(priceFilterStr) + " " + item.ExchangeCurrency + " <span class=\"taxinc\">+KDV</span>";
                                    }
                                    @if (Parameters.ShowExchangePricesWithoutTax && item.ExchangePrice > 0)
                                    {
                                        productExchangePrice = item.ExchangePrice.ToString(priceFilterStr) + " " + item.ExchangeCurrency + " <span class=\"taxinc\">+KDV</span>";
                                    }
                                    @if (Parameters.ShowPricesWithoutTax && item.SpecialPriceWithOutTax > 0)
                                    {
                                        productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.SpecialPriceWithOutTax) : item.SpecialPriceWithOutTax).ToString(priceFilterStr) + " " + item.Currency + " <span class=\"taxinc\">+KDV</span>";
                                        productNewPriceNumber = item.SpecialPriceWithOutTax;
                                    }
                                    else if (Parameters.ShowPricesWithoutTax && item.SpecialPriceWithOutTax <= 0)
                                    {
                                        productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.PriceWithOutTax) : item.PriceWithOutTax).ToString(priceFilterStr) + " " + item.Currency + " </span><span class=\"taxinc\">+KDV</span>";
                                        productNewPriceNumber = item.PriceWithOutTax;
                                    }
                                    else if (!Parameters.ShowPricesWithoutTax && item.SpecialPrice > 0)
                                    {
                                        productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.SpecialPrice) : item.SpecialPrice).ToString(priceFilterStr) + " " + item.Currency;
                                        productNewPriceNumber = item.SpecialPrice;
                                    }
                                    else if (!Parameters.ShowPricesWithoutTax && item.SpecialPrice <= 0)
                                    {
                                        productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.Price) : item.Price).ToString(priceFilterStr) + " " + item.Currency;
                                        productNewPriceNumber = item.Price;
                                    }
                                    @{
                                    var rate = (item.CampaignProduct && Model.CampaignVoucherRate > 0) ? Model.CampaignVoucherRate : Model.VoucherRate;
                                    if (rate > 0 && !(Parameters.OnlyUseCCandMTforOpportunityProduct && item.OpportunityProduct))
                                    {
                                        productSecondPrice = ((productNewPriceNumber * rate) / (Parameters.ShowVoucherPricesWithInstallment ? Parameters.SenetTaksit1 : 1)).ToString(priceFilterStr) + " " + item.Currency;
                                    }
                                    }
                                    <a href="@item.LinkUrl" class="sale">@if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                                                         {
                                                                            
                                        <div class="product-price-section">
                                            @{
                                                <span class="productNewPriceStr productPrice">@Html.Raw(productNewPrice)</span>
                                                                             if (!string.IsNullOrEmpty(productExchangePrice))
                                                                             {
                                                <span class="productNewPriceStr productPrice">@Html.Raw(productExchangePrice)</span><br />
                                                                             }
                                                                             if (productSecondPrice != "")
                                                                             {
                                                <span class="productSecondPriceStr"><span class="senetliAyda">@(Parameters.ShowVoucherPricesWithInstallment ? "ayda " : "")</span>@Html.Raw(productSecondPrice)</span>
                                                                             }
                                            }
                                        </div>
                                    
                                                                             if (productSecondPrice != "")
                                                                             {
                                        <div class="product-price-section">
                                            <span class="fiyatAciklama"><span class="fiyatAciklamaSolCizgi">- </span>@(kkMetin)<span class="fiyatAciklamaSagCizgi"> - </span></span>
                                            <span class="fiyatAciklama"><span class="fiyatAciklamaSolCizgi">- </span>@(snMetin)<span class="fiyatAciklamaSagCizgi"> - </span></span>
                                        </div>
                                                                             }
                                                                             if (productOldPrice != "")
                                                                             {
                                        <span class="sale-original">@productOldPrice @item.Currency</span>
                                                                             }
                                                                             else if (item.DiscountDisplayTotal > 0)
                                                                             {
                                                                                 var indirimGoster = ((Decimal.Parse(productNewPrice.Replace(" TL", "")) / (100 - item.DiscountDisplayTotal)) * 100);
                                        <span class="sale-original">@indirimGoster.ToString("###,###,##0") @item.Currency</span>
                                                                             }
                                                                             else if (item.MarketPrice > 0)
                                                                             {
                                        <span class="sale-original">@item.MarketPrice.ToString("###,###,##0") @item.Currency</span>
                                                                             }
                                                                         }
                                                                         else
                                                                         {
                                        <span style="font-weight: normal;">Tükendi</span>   
                                                                         }
                                    </a>
                                </div>
                                @if (showNamesBottom)
                                {
                                    <div class="product-title">
                                        <a id="pl_@item.ProductId" class="prdLink" href="@item.LinkUrl">@(item.ProductName)</a>
                                    </div>
                                    <div class="clearfix"></div>
                                }
                                @if (Parameters.UseWishList)
                                {
                                    <div class="toList">
                                        <a id="prd_@item.ProductId" onclick="addToWishList('@(item.ProductId)');" >
                                            <img
                                src="/Images/@(Parameters.Theme)/ToList.jpg" title="Listeme Ekle" alt="Listeme Ekle" style="width: 35px;
                                height: 35px; vertical-align: middle;margin-top:5px" /></a>
                                    </div>
                                }
                                @if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                {
                                    if (addToCartButtonStyle == 2)
                                    {<div class="toCart">
                                        <a id="cart_@item.ProductId" @{if (item.InstallmentNeeded)
                                                                       { <text>href="@item.LinkUrl"</text> }
                                                                       else
                                                                       { <text>class="addToCart"</text> }} >
                                            <button class="button-alt">Sepete Ekle</button>
                                        </a>
                                    </div>
                                    }
                                    else if (addToCartButtonStyle == 3)
                                    { 
                                    <div class="hover_block">
                                        <ul class="add-to-links">
                                            <li>
                                                <a id="cart_@item.ProductId" @{if (item.InstallmentNeeded)
                                                                               { <text>href="@item.LinkUrl"</text> }
                                                                               else
                                                                               { <text>class="addToCart"</text> }} >
                                                    <button type="button" class="button btn-cart">
                                                        <span>
                                                            <span>Sepete Ekle</span>
                                                        </span>
                                                    </button>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                    }
                                    else
                                    {
                                    <div class="toCart">
                                        <a id="cart_@item.ProductId" @{if (item.InstallmentNeeded)
                                                                       { <text>href="@item.LinkUrl"</text> }
                                                                       else
                                                                       { <text>class="addToCart"</text> }} title="Sepete Ekle">
                                            <img src="/Images/@(Parameters.Theme)/urun-hover-sepet.png" alt="Sepete Ekle" />
                                        </a>
                                    </div>
                                    
                                    }
                                }
                                @if (Model.IsManager || Model.IsSeoManager)
                                {
                                    <div class="manageProduct">
                                        <a href="/ProductManage/Edit/@(item.ProductId)" class="urunDuzenle fancybox.iframe">
                                            <i class="fa fa-edit fa-2x"></i>
                                        </a>
                                        @if (Model.IsManager)
                                        {
                                            <a href="/Products/RemoveFromCategory/@(Model.CategoryId)/@(item.ProductId)" class="urunSil fancybox.iframe">
                                                <i class="fa fa-remove fa-2x"></i>
                                            </a>
                                            <a href="javascript:void(0);" data-productid="@(item.ProductId)" data-variantcount="@(item.VariantCount)" title="@(item.IsActive ? "Pasifleştir" : "Aktifleştir")" class="urunAktifPasif">
                                                <span class="@(item.IsActive ? "product-icon-active" : "product-icon-deactive")"></span>
                                            </a>
                                        }
                                    </div>
                                }
                            </div>
                        </div>
                    </li>
                                var cc2 = columnCount;
                                columnCount = columnCount * rowCount;
                                if (itemCounter % columnCount == 0 && itemCounter <= Model.RelatedProducts.Count() - 1)
                                {
                    @Html.Raw("</ul><ul class=\"productsList\">");
                                }
                                itemCounter++;
                                columnCount = cc2;
                }
            </ul>
        </div>
                if (Model.RelatedProducts.Count() > columnCount * rowCount && sliderForProducts)
                {
        <script type="text/javascript">
            $(document).ready(function ()
            {
                if ($(window).width() > 999)
                {
                    $("#products@(Model.CategoryId)").slidesjs({
                        width: 1000,
                    @{
                    if (columnCount == 6)
                    {
                        <text>height: 175,</text>
                    }
                    else if (columnCount == 4)
                    {
                        <text>height: 205,</text>
                    }
                    else if (columnCount == 3)
                    {
                        <text>height: 260,</text>
                    }
                    }
                        pagination: {
                            active: false
                        },
                        navigation: {
                            active: true,
                            effect: "slide"
                        },
                        play: {
                            active: false,
                            effect: "slide",
                            interval: 5000,
                            auto: true,
                            swap: false,
                            pauseOnHover: true,
                            restartDelay: 4500
                        },
                        pauseOnHover: true
                    }).addClass("itWithSlider");
                    $("a.slidesjs-navigation").html("");
                }
            });
        </script>
                }
                else
                {
        <script>
            $(document).ready(function ()
            {
                if ($(window).width() > 999)
                {
                    $('.notSlider .product-image a.prdLink ul').each(function ()
                    {
                        if ($(this).find("li").length > 1 && $(this).find(".bx-wrapper").length < 1)
                        {
                            var _this = $(this).bxSlider({
                                mode: 'horizontal',
                                easing: 'ease-in',
                                startSlide: 0,
                                slideMargin: 0,
                                moveSlides: 1,
                                infiniteLoop: true,
                                auto: true,
                                autoStart: false,
                                autoHover: true,
                                controls: false,
                                pause: 2500
                            });
                            _this.mouseenter(function ()
                            {
                                _this.startAuto();
                            }).mouseleave(function ()
                            {
                                _this.stopAuto();
                            });
                        }
                    });
                }
            });
        </script>
                }
        <script>
            $(document).ready(function ()
            {
                if ($(window).width() <= 999)
                {
                    var sayyac = 1;
                    $("#products@(Model.CategoryId) ul.productsList").each(function ()
                    {
                        if (sayyac == 1)
                        {
                            $(this).addClass("mainList");
                        }
                        else
                        {
                            $("#products@(Model.CategoryId) .mainList").append($(this).html());
                            $(this).remove();
                        }
                        sayyac++;
                    });
                    $("#products@(Model.CategoryId) ul.productsList").find("li.inLastColumn").removeClass("inLastColumn");
                    var liSayac = 1;
                    $("#products@(Model.CategoryId) ul.productsList").find("li.productLi").each(function ()
                    {
                        if (liSayac % 2 == 0)
                        {
                            $(this).addClass("inLastColumn");
                        }
                        liSayac++;
                    });
                    $("ul.productsList").find("li.inLastColumn").removeClass("inLastColumn");
                    var liSayac = 1;
                    $("ul.productsList").find("li").each(function ()
                    {
                        if (liSayac % 2 == 0)
                        {
                            $(this).addClass("inLastColumn");
                        }
                        liSayac++;
                    });
                }
            });
        </script>
    }
    else if (Model.RelatedProducts.Count == 0)
    {
        <br /><text>Henüz ürün eklenmemiştir.</text>
    }
</div>
